package cn.leftsite.java11;

import java.time.LocalDate;
import java.util.List;
import java.util.Set;
import java.util.stream.Stream;

public class ApiDemo {
    public static void main(String[] args) {
        // 更简单的方式创建集合, 返回不可变集合
        List<String> list = List.of("aa", "bb", "cc", "dd");
        System.out.println(list);

        // java.lang.IllegalArgumentException: duplicate element: 5
        // Set<Integer> set = Set.of(1, 2, 3, 4, 5, 5);
        Set<Integer> set = Set.of(1, 2, 3, 4, 5);
        System.out.println(set);

        LocalDate localDate = LocalDate.of(2019, 1, 21);
        System.out.println(localDate);

        Stream<Integer> stream = Stream.of(1, 2, 3, 4, 5);
        System.out.println(stream);

    }
}
